#!/usr/bin/perl -wc

package RFCMail::Util::Callback;

# Convenience function for invoking Event-style callbacks.

use strict;
use warnings;
use base qw(Exporter);

our @EXPORT_OK = qw(callback);

sub callback {
    my $self = shift;
    if (ref($self) eq 'ARRAY') {
	my ($obj, $meth) = @$self;
	$obj->$meth(@_);
    }
    else {
	goto $self;
    }
}

1;
